package com.aiden.cashbook.bill

import com.aiden.cashbook.bean.Bill
import com.aiden.cashbook.data.charge.ChargeDataSource
import com.aiden.cashbook.data.charge.ChargeRepository
import javax.inject.Inject

class BillPresenter @Inject constructor(var repository: ChargeRepository): BillContract.Presenter {

    private lateinit var view: BillContract.View

    override fun billList(userId: Long, page: Int, size: Int) {
        repository.billList(userId, page, size, object : ChargeDataSource.LoadListCallBack<Bill> {
            override fun onDataLoaded(list: List<Bill>) {
                view.loadSuccess(list)
            }

            override fun onDataNotAvailable() {
                view.loadFailure()
            }
        })
    }

    override fun takeView(view: BillContract.View) {
        this.view = view
    }

    override fun dropView() {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }
}